/*
 * JSFConsole - Lightweight JSF Application Monitor
 * Copyright (C) 2009  Grzegorz Bugaj
 * http://www.gregbugaj.com
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/
package com.gregbugaj.reflector.ui;

import javax.faces.component.UIComponent;
import javax.faces.webapp.UIComponentELTag;

public class SteppingStoneTag extends UIComponentELTag {
	// PROPERTY: object that we want to inspect
	private javax.el.ValueExpression object;
	public void setObject(javax.el.ValueExpression object) {
		this.object = object;
	}
		
	@Override
	public String getComponentType() {
		return "com.smx.steppingstone.ui.UISteppingStone";
	}

	@Override
	public String getRendererType() {
		return null;
	}

	@Override
	protected void setProperties(UIComponent component) {
		try{
			super.setProperties(component);
			UISteppingStone stone = null;
			try {
				stone = (UISteppingStone)component;	
			} catch (ClassCastException cce) {
				throw new IllegalStateException(
						"Component "
						+ component.toString()
						+ " not expected type.  Expected: com.smx.steppingstone.ui.UISteppingStone  Perhaps you're missing a tag?");
			}

			/**
		//Inidicates current selection of item
		ValueExpression selectedExp=application.getExpressionFactory().createValueExpression(context.getELContext(), selected.getExpressionString(), Class.class);
		component.setValueExpression("selected", selectedExp);
			 */
			if(null!=object){
				stone.setValueExpression("object", object);			
			}
		}catch (Exception e){
			e.printStackTrace();
		}
	}

	@Override
	public void release() {
		super.release();
	}




}
